from django.db import models
import django.utils.timezone as timezone
# Create your models here.

class Doc(models.Model):
    title = models.CharField(max_length=250,verbose_name='资料名称')
    file = models.FileField(upload_to='Service/',blank=True,verbose_name='文件资料')
    # default=timezone这里写错了；报错是Django 无法序列化：timezone是个模块而不是函数，正确的是default=timezone.now,
    publishDate = models.DateTimeField(max_length=20,default=timezone,verbose_name='发布时间')

    def __str__(self):
        return self.title
    class Meta:
        ordering = ['-publishDate'] # 为啥要用列表形式
        verbose_name = '资料'
        verbose_name_plural =  verbose_name